﻿



CREATE FUNCTION dbo.f_Ghost
(@LoanID int,@Pulled bit)
RETURNS bit WITH SCHEMABINDING BEGIN 

DECLARE @Ret int

IF @Pulled <> 1 RETURN 0

RETURN(
	SELECT ~ CONVERT(bit,count(*))
	FROM dbo.v_TradeReferences
	WHERE LoanID = @LoanID
)

--RETURN ~ CONVERT(bit,@Ret)

END






